/*
 *    Copyright © OpenAtom Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.inspur.edp.cef.variable.dtgenerator.api.mginterface.resinfo;

import com.inspur.edp.caf.generator.utils.ExpressionUtils;
import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext;
import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.MgrInterfaceGeneratorContext;
import com.inspur.edp.cef.generator.apiGenerator.dataType.mgrInterface.resourceInfo.ModelInfoCtorGenerator;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.SuperConstructorInvocation;

public class VarModelInfoCtorGenerator extends ModelInfoCtorGenerator {

  private final String className;
  private final String currentSu;
  private final String metadataId;
  private final String rootNodeCode;
  private final String displayKey;
  private final CefApiGeneratorContext parentContext;

  public VarModelInfoCtorGenerator(String className, String currentSu, String metadataId,
      String rootNodeCode, String displayKey,
      CefApiGeneratorContext parentContext) {
    super(className, currentSu, metadataId, rootNodeCode, displayKey, parentContext);
    this.className = className;
    this.currentSu = currentSu;
    this.metadataId = metadataId;
    this.rootNodeCode = rootNodeCode;
    this.displayKey = displayKey;
    this.parentContext = parentContext;
  }

  @Override
  protected Block buildMethodBody() {
    Block block=ast.newBlock();
    SuperConstructorInvocation superConstructorInvocation=	ast.newSuperConstructorInvocation();
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, currentSu));
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, metadataId));
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, rootNodeCode));
    superConstructorInvocation.arguments().add(ExpressionUtils.getStringLiteral(ast, displayKey));
    block.statements().add(superConstructorInvocation);
    return block;
  }
}
